// 引入axios
import {proRequest} from "@/request"

// 定义数据类型
interface CategoryData {
  id: number,
  createTime: string
  updateTime: string,
  name: string,
  category2Id?: number
  category1Id?: number
}
// 调用接口
// 获取一级菜单列表
export const getCategoryList = () =>{
  return proRequest.get<any,CategoryData[]>('/admin/product/getCategory1')
}
export const getCategory2List = (category1Id:number | string)=>{
  return proRequest.get<any,CategoryData[]>(`/admin/product/getCategory2/${category1Id}`)
}

// GET /admin/product/getCategory3/{category2Id}
// getCategory3
export const getCategory3List = (category2Id:number | string)=>{
  return proRequest.get<any,CategoryData[]>(`/admin/product/getCategory3/${category2Id}`)
}